const path = require('path')
const os = require('os')
const mediapath = './media/'
const ardu_start = [
    '--verify', //验证
    '--upload', //上传
    '--board', //板子的名称
    '--port', //板子的串口号
    '--pref', //首选项
    '-v|--verbose', //详细信息
    '--preserve-temp-files', //保存 .hex 文件
    'FILE.ino' //文件路径
]
const apppack = path.join(os.homedir(), ".hterobotapp/")
const scratchpath = path.join(__dirname, './scratch.html')
let arduino_cmd_guesses = path.join(apppack, './Arduino/arduino_debug.exe')
const textIno = path.join(apppack, './ino/text.ino');
const arduino_path = path.join(apppack, './Arduino');
const build_path = path.join(apppack, './cache')
if (process.platform === "darwin") {
    arduino_cmd_guesses = path.join(apppack, '/Arduino.app/Contents/MacOS/Arduino')
}
const geiArduinoCmd = function(build, board = 'arduino:avr:uno', port) {
    if (port == null) {
        return `"${arduino_cmd_guesses}" ${build} ${ardu_start[2]} ${board}    -v --pref "build.path=${build_path}"  --preserve-temp-files "${textIno}"`
    } else {
        return `"${arduino_cmd_guesses}" ${build} ${ardu_start[2]} ${board} ${ardu_start[3]} ${port} -v --pref "build.path=${build_path}" --preserve-temp-files "${textIno}"`
    }
}

const Official = `

-------------------------------------------------------------
-------------------------------------------------------------
---------**------**--------**********--------**********------
---------**------**------------**------------**--------------
---------**------**------------**------------**--------------
---------**********------------**------------*********-------
---------**------**------------**------------**--------------
---------**------**------------**------------**--------------
---------**------**------------**------------**********------
-------------------------------------------------------------
-------------------------------------------------------------

`